<?php

/**
 * Outilpedagogique form.
 *
 * @package    espace14
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class OutilpedagogiqueForm extends BaseOutilpedagogiqueForm
{
  public function configure()
  {
  $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      //'photourl'    => new sfWidgetFormTextarea(),
      //'description' => new sfWidgetFormTextarea(),
	  'photourl'    => new sfWidgetFormInputFileEditable(array('file_src'  => sfConfig::get('sf_root_dir').'/'.sfConfig::get('sf_web_dir_name')
	  .'/'.sfConfig::get('sf_image_dir_name')
	  .'/'.sfConfig::get('sf_upload_dir_name'), 
  			            'is_image' => true,
						'with_delete' => true,
			            'edit_mode' => !$this->isNew(),
						)),
	  'description' => new sfWidgetFormInputHidden(),
	  'rubrique'    => new sfWidgetFormSelect(array('choices'=>array('Centre Pilote','Equipement','Unite Chirurgicale','Unite Formation')))
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      //'photourl'    => new sfValidatorString(array('max_length' => 500, 'required' => false)),
	   'photourl'    => new sfValidatorFile(array('max_size' => '20971520','mime_types' => 'web_images','path' => sfConfig::get('sf_upload_dir'),'required'=>false)),
      'description' => new sfValidatorString(array('max_length' => 3000,'required' => false)),
	  'rubrique'    => new sfValidatorChoice(array('choices'=>array_keys(array('centrepilote','equipement','unitechirurgicale','uniteformation')),'required'=>true))
    ));
	$this->widgetSchema->setNameFormat('outilpedagogique[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::configure();
  }
}
